﻿package com.sgcc.nfc.lock.data.local.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.sgcc.nfc.lock.data.local.entity.WarningEntity
import kotlinx.coroutines.flow.Flow

@Dao
interface WarningDao {
    @Query("SELECT * FROM warnings ORDER BY createTime DESC")
    fun observeWarnings(): Flow<List<WarningEntity>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun upsertAll(warnings: List<WarningEntity>)

    @Query("DELETE FROM warnings")
    suspend fun clear()
}
